package com.ql.mangersystem.mapper;

import com.ql.mangersystem.common.Page;
import com.ql.mangersystem.entity.po.Logs;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Entity com.ql.mangersystem.entity.po.Logs
 */
@Mapper
public interface LogsMapper {

    @Insert("insert into `logs` (ip,user,type,operation,time) values (#{ip},#{user},#{type},#{operation},#{time})")
    int insert(@Param("ip") String ip, @Param("user") String user, @Param("type") String type, @Param("operation") String operation, @Param("time") String time);

    @Delete("delete from `logs` where id = #{id}")
    int delete(Integer id);

    int deleteBatch(List<Integer> ids);

    @Select("select * from logs order by id limit #{skipNum},#{pageSize}")
    List<Logs> page(@Param("skipNum") Integer skipNum,@Param("pageSize") Integer pageSize);
    @Select("select  count(id) from logs")
    Integer count();

    @Select("select*from logs where operation like concat('%',#{operation},'%') order by id limit #{skipNum},#{pageSize}")
    List<Logs> pageLike(@Param("operation") String operation, @Param("skipNum") Integer skipNum, @Param("pageSize") Integer pageSize);


    @Select("select  count(id) from logs where operation like concat('%',#{operation},'%')")
    Integer countLike(String operation);
}




